<template>
	<view class="content">
		<u-sticky bgColor="#fff">
			<u-tabs :list="tabList" :current="tabIndex" @click="touchT"></u-tabs>
		</u-sticky>
		<abnor v-if="list.length<=0"></abnor>
		<view class="list" v-else>
			<view class="item" v-for="(item,index) in list" :key="index" @click="toD(item.treat_inv_id,item.pay_type)">
				<!-- <view class="time font36" style="margin-bottom: 16rpx;">
					 创建时间:{{item.create_time}}
				</view> -->
				<view class="font36">
					订单号:{{item.order_code}}
				</view>
				<view class="info">
					<view class="information">
						<view class="left font36 fontw" style="flex-direction: column;align-items: unset;">
							<view class="type">
								项目:{{item.service.title}}
							</view>
						</view>
						<view class="left font36 fontw">
							<view class="">
								门店:{{item.store.title}}
							</view>
						</view>
						<view class="left font36 fontw">
							<view class="">
								地址:{{item.store.address}}
							</view>
						</view>
						<view class="price font34 fontw">
							<text class="font22">￥</text>{{item.pay_price}}
						</view>
					</view>
					<view class="">
						<image :src="item.verification_code" mode="" style="width: 190rpx;height: 190rpx;"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				tabList: [{
					name: '未核销'
				}, {
					name: '已核销'
				}],
				tabIndex: 0,
				tabs: 2
			};
		},
		onLoad() {
			this.getData()
		},
		onPullDownRefresh() {
			// #ifndef APP-PLUS
			uni.showNavigationBarLoading()
			// #endif
			this.getData()
			uni.stopPullDownRefresh()
		},
		methods: {
			async getData() {
				const data = await this.$api.shareholder.treatOrderList({
					pay_type: this.tabs
				})
					this.list = data
				this.$util.hideAll()
			},
			touchT(e) {
				this.tabIndex = e.index
				if (e.index == 0) {
					this.tabs = 2
				}
				if (e.index == 1) {
					this.tabs = 7
				}
				this.list = []
				this.getData()
			},
			toD(id, pay_type) {
				if (pay_type == 7) {
					uni.showToast({
						title: '此订单已核销',
						icon: 'error',
						duration: 1000
					})
					return
				}
				if (pay_type == 2) {
					uni.navigateTo({
						url: '/user/pages/distribution/posterss?id=' + id
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.content {
		.list {
			padding: 23rpx 37rpx;

			.item {
				border-radius: 16rpx;
				margin-bottom: 23rpx;
				background-color: #fff;
				padding: 32rpx 22rpx;

				.time {}

				.info {
					margin-top: 16rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.image {
						width: 169rpx;
						height: 169rpx;
						border-radius: 21rpx;
						overflow: hidden;
						margin-right: 18rpx;

						image {
							width: 169rpx;
							height: 169rpx;
						}
					}

					.information {
						flex: 1;

						.left {
							margin-bottom: 11rpx;

							.type {
								margin-right: 8rpx;
							}

							.duration {}

							.range {
								margin-right: 8rpx;
							}

							.ding {}
						}

						.tips {
							margin-bottom: 19rpx;
						}

						.price {
							color: #FF4A00;
						}
					}

					.ewm {
						width: 158rpx;
						height: 158rpx;
						border-radius: 21rpx;
						overflow: hidden;
						margin-left: 18rpx;

						image {
							width: 158rpx;
							height: 158rpx;
						}
					}
				}
			}
		}
	}
</style>